﻿<?xml version="1.0" encoding="utf-8" ?>
<Feature id="BizObjTree" name="BizObj Tree Information">
	<Dependencies>
		<Dependency type="feature">SecurityFeature.xml</Dependency>
		<Dependency type="feature">CryptographyFeature.xml</Dependency>
	</Dependencies>

	<BusinessRules>

		<BusinessRule name="refreshLatestUpdatedForParents" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="increateNodeViewCount" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="updateParentNodesLastUpdated" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="incrementParentNodeCounts" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="decrecrementParentNodeCounts" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getBizObjFromKeyName" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="insertBizObjIntoTree" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="updateBizObjTreeNode" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getBizObjTreeParents" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="getBizObjTreeChildren" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="renameBizObjInTree" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="moveBizObjInTree" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="removeBizObjFromTree" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
		<BusinessRule name="fixupTreeKeyNames" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>


		<BusinessRule name="migrateBizObjTreeSqlTables" security="disabled">
			<LocalClass name="Syrinx.BizObjTreeBizRules,ScsCore" />
		</BusinessRule>
	</BusinessRules>	  

	<BusinessObjects>
		<BusinessObject type="ObjectTreeNodeCount" key="objectId">
			<Field name="objectId" type="Guid" />
			<Field name="totalL1" type="Integer" />
			<Field name="totalL2" type="Integer" />
			<Field name="totalL3" type="Integer" />
			<Field name="totalL4" type="Integer" />
			<Field name="totalViews" type="Integer" />
			<Field name="lastViewed" type="Date"/>
			<Field name="lastChildUpdated" type="Date"/>
			<Field name="lastChildUpdatedBy" type="User" />
			<Field name="dateCreated" type="Date"/>
			<Field name="dateUpdated" type="Date"/>
			<Field name="author" type="User" />

			<Method name="totalL1L2" language="jscript.NET">
				<![CDATA[
				return self.getItem("totalL1") + self.getItem("totalL2");
			]]>
			</Method>
			<Method name="lastChildUpdatedDisplayDate" language="jscript.NET">
				<![CDATA[
				var pd = self.getItem("lastChildUpdated");
        return Swaf.Container.DateFormattingNode.FormatDate(pd, "easy", true);
			]]>
			</Method>
			<Method name="dateUpdatedDisplayDate" language="jscript.NET">
				<![CDATA[
				var pd = self.getItem("dateUpdated");
        return Swaf.Container.DateFormattingNode.FormatDate(pd, "easy", true);
			]]>
			</Method>
		</BusinessObject>

		<BusinessObject type="TreeNodeInfo" key="id">
			<Field name="id" type="String"/>
			<Field name="numberOfDirectChildren" type="Integer"/>
		</BusinessObject>

		<BusinessObject type="TreeNode" key="id,parentHostId" >
			<Field name="id" type="Guid">
				<NULL/>
			</Field>
			<Field name="name" type="String" />
			<Field name="parentId" type="Guid">
				<NULL/>
			</Field>
			<Field name="parentHostId" type="Guid">
				<NULL/>
			</Field>
			<Field name="objectId" type="Guid">
				<NULL/>
			</Field>
			<Field name="rootId" type="Guid">
				<NULL/>
			</Field>
			<Field name="keyName" type="String" />
			<Field name="depth" type="Integer" />
			<Field name="treeName" type="String"/>
			<Field name="counts" type="ObjectTreeNodeCount" />

			<Method name="shortId" language="jscript.NET">
				<![CDATA[
				var i = self.getItem("id");
				return ((i==null)?"":i.ToString().Replace("-",""));
				
			]]>
			</Method>
			<Method name="shortParentId" language="jscript.NET">
				<![CDATA[
				var i = self.getItem("parentId");
				return ((i==null)?"":i.ToString().Replace("-",""));
				
			]]>
			</Method>

			<Method name="nameWithParent" language="jscript.NET"><![CDATA[
				var kn = self.getItem("keyName").Split('\x0D');
				if(kn.length > 1)
				{
					var pname = kn[kn.length-2];
					var i = pname.indexOf("~!");
					if(i != -1)
						pname = pname.substr(i + 2);
					return self.getItem("name") + "   #&lt;#span class='parentNameInCombo'#&gt;#(in " + pname + ")#&lt;#/span#&gt;#";
				}
				else if(kn.length > 0)
					return self.getItem("name");
				else
					return kn;
			]]></Method>
			
			<Method name="depthName" language="jscript.NET">
				<![CDATA[				
				var depth : Int32 = self.getItem("depth");
				var str = self.getItem("name");
				if(depth != 0) {
					var width = depth*25;
					str="#&lt;#div style='margin-left:" + width + "px'#&gt;#" + str + "#&lt;#/div#&gt;#";
				}
				return str;
			]]>
			</Method>
			<Method name="spacedDepthName" language="jscript.NET">
				<![CDATA[				
				var depth : Int32 = self.getItem("depth");
				var str = self.getItem("name");
				if(depth != 0) {
					var buff = new StringBuilder(100);
					for(var c = 0; c < depth; c++)
						buff.Append("     ");
					buff.Append(str);
					str = buff;
				}
				return str;
			]]>
			</Method>
			<Method name="htmlDepthName" language="jscript.NET">
				<![CDATA[				
				var depth : Int32 = self.getItem("depth");
				var str = self.getItem("name");
				if(depth != 0) {
					var width = depth*25;
					str="<div style='margin-left:" + width + "px'>" + str + "</div>";
				}
				return str;
			]]>
			</Method>
			<Method name="spandepthName" language="jscript.NET">
				<![CDATA[				
				var depth : Int32 = self.getItem("depth");
				var str = self.getItem("name");
				if(depth != 0) {
					var width = depth*25;
					str="#<#span#>##<#/span#>##<#span style='padding-left:" + width + "px'#>#" + str + "#<#/span#>##<#/span#>#";
				}
				return str;
			]]>
			</Method>
			<Method name="simpleTreeName" language="jscript.NET">
				<![CDATA[
				return self.getItem("depthName").replace(/#/g,"");
			]]>
			</Method>
		</BusinessObject>

	</BusinessObjects>
	<!--
	<ApplicationEvents>
		<ApplicationStart>
			<Rule method="migrateBizObjTreeSqlTables" paramHandling="specifiedOnly">
				<Params/>
			</Rule>
		</ApplicationStart>
	</ApplicationEvents>
	-->
</Feature>
